package com.longrise.android.byjk.plugins.vip.integralexchange;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/**
 * Created by callxkj on 2017/8/1.
 * 积分任务
 */

public class IntegralTaskAdapter extends FragmentPagerAdapter {

    private final String mDailyUrl;
    private final String mBasicUrl;

    public IntegralTaskAdapter(FragmentManager fm, String dailyurl, String basicurl) {
        super(fm);
        this.mDailyUrl = dailyurl;
        this.mBasicUrl = basicurl;
    }

    @Override
    public Fragment getItem(int position) {
        IntegralTaskFragment fragment = new IntegralTaskFragment();
        Bundle bundle = new Bundle();
        switch (position){
            case 0:
                bundle.putString(IntegralTaskFragment.URL,mDailyUrl);
                bundle.putString(IntegralTaskFragment.CURRENT_PAGE,IntegralTaskFragment.DAILY_TASK);
                break;
            case 1:
                bundle.putString(IntegralTaskFragment.URL,mBasicUrl);
                bundle.putString(IntegralTaskFragment.CURRENT_PAGE,IntegralTaskFragment.BASIC_TASK);
                break;
        }
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public int getCount() {
        return 2;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        String title = null;
        switch (position) {
            case 0:
                title = "每日任务";
                break;
            case 1:
                title = "基本任务";
                break;
        }
        return title;
    }
}
